﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JohnnySins.Entities
{
    public class PhotoSet
    {
        public int PhotoSetId { get; set; }
        public string PhotoSetTitle { get; set; }
        public DateTime? PhotoSetDate{ get; set; }
        public string PhotoSetStarring { get; set; }
        public string PhotoSetDescription { get; set; }
        public bool IsActive { get; set; }
        public bool IsPublic { get; set; }
        public bool IsMember { get; set; }
        public bool Selected { get; set; }
        public string Status
        {
            get
            {
                return IsActive ? "Active" : "Deactivate";
            }
        }

        public string PhotoFiles 
        {
            get
            {
                if (Photos == null)
                    return "";
                string agg = Photos.Aggregate("", (str, obj) => str + obj.PhotoSetPhotoFileName + ", ");
                if (!string.IsNullOrEmpty(agg))
                    agg = agg.Substring(0, agg.Length - 2);

                return agg;
            }
        }

        public IEnumerable<PhotoSetPhoto> Photos { get; set; }
    }

    public class PhotoSetPhoto
    {
        public int PhotoSetPhotoId { get; set; }
        public int PhotoSetId { get; set; }
        public string PhotoSetPhotoFileName { get; set; }

        public string PhysFileName
        {
            get
            {
                return PhotoSetPhotoId.ToString() + "-" + PhotoSetPhotoFileName;
            }
        }

        public bool IsPublic { get; set; }
        public bool IsMember { get; set; }
        public bool IsPublicPoster { get; set; }
        public bool IsMemberPoster { get; set; }
        public string PhotoSetTitle { get; set; }
    }
}
